package com.atguigu.juc.atomics;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author yfstart
 * @create 2022-07-20 0:05
 */
public class CasDemo {
  public static void main(String[] args) {
    AtomicInteger atomicInteger = new AtomicInteger(5);
    System.out.println(atomicInteger.compareAndSet(5, 2022) + "\t" + atomicInteger.get());
    System.out.println(atomicInteger.compareAndSet(5, 9999) + "\t" + atomicInteger.get());
    atomicInteger.getAndIncrement();
  }
}
